<template>
  <div class="search-box">
    <div class="search-box-top">
      <h3>关键词排行</h3>
      <!-- <div class="exportBtn"
           @click="exportBtn">导出数据</div> -->
    </div>
    <el-table
      class="search-table"
      :data="tableData"
      style="width: 96%"
    >
      <!-- <el-table-column
        type="selection"
        width="55"
      /> -->
      <el-table-column
        prop="trade_name"
        label="行业分类"
        align="center"
      />
      <el-table-column
        prop="totalNum"
        label="总搜索"
        align="center"
      />
      <el-table-column
        prop="monthNum"
        label="本月"
        align="center"
      />
      <el-table-column
        prop="weekNum"
        label="本周"
        align="center"
      />
      <el-table-column
        prop="dayNum"
        label="本日"
        align="center"
      />
      <!-- <el-table-column
        prop="address"
        label="操作"
        align="center"
      >
        <template slot-scope="scope">
          <div
            class="seeBtn"
            @click="seeBtn(scope.row)"
          >查看</div>
        </template>
      </el-table-column> -->
    </el-table>
    <div class="pagination-block">
      <el-pagination
        prev-text="上一页"
        next-text="下一页"
        :background="true"
        :current-page.sync="currentPage"
        :page-size="pagesize"
        layout="prev, pager, next,total,slot, jumper"
        :total="total"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      >
        <div
          class="page-number"
          layout="slot"
        >
          <div class="jump-button">跳至</div>
        </div>
      </el-pagination>
    </div>
  </div>
</template>

<script>
// import page from '../comptent/page'
import { getSearchData } from '@/api/statistics.js'
export default {
  data() {
    return {
      tableData: [],
      currentPage: 1,
      pagesize: 0,
      total: 0
    }
  },
  created() {
    this.getData(1, 10)
  },
  methods: {
    // 获取数据
    getData(pageNum, pageSize) {
      getSearchData({
        pageNum: pageNum,
        pageSize: pageSize
      }).then(res => {
        // console.log(res)
        this.tableData = res.data.list
        this.total = res.data.total
        this.pagesize = res.data.pageSize
      })
    },
    exportBtn() { },
    seeBtn() { },
    handleSizeChange() { },
    handleCurrentChange() {
      // console.log(this.currentPage)
      this.getData(this.currentPage, 10)
    }
  }
}
</script>
